<template>
    <section class="container">
        <div>
            <div class="banner">
                <div class="head-img"></div>
                登录
            </div>
            <div class="setting-list">
                <div class="set-item">
                    收藏
                </div>
                <div class="set-item">
                    发布
                </div>
                <div class="set-item">
                    信息
                </div>
                <div class="set-item">
                    粉丝
                </div>
            </div>
        </div>
    </section>
</template>

<script>
    import modal from '~/components/modal.vue'
    import {userApi} from "../../api/user.js"
    export default {
        components: {
            modal
        },
        data(){
            return {
                phone:'',pwd:'',msg:{}
            }
        },
        mounted(){
            this.checkLogin()
        },
        methods:{
            register(){
                let that = this
                let user = {
                    phone: this.phone,
                    pwd: this.pwd
                }
                userApi.register(user).then(function (res) {
                    localStorage.token = res.data.token
                    localStorage.userInfo = JSON.stringify(res.data.userInfo)
                    that.msg={
                        type:2,text:"注册成功"
                    }
                    setTimeout(function () {
                        that.$router.push({path:'/'})
                    },500)
                })
            },
            checkLogin(){
                let userInfo = localStorage.token
                if(userInfo && userInfo!="undefined"){
                    return true
                }else{
                    this.$router.push({path:'/login/login'})
                }
            }
        }
    }
</script>

<style lang="scss">
    .container {
        min-height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        text-align: center;
    }

    .title {
        font-family: "Quicksand", "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; /* 1 */
        display: block;
        font-weight: 300;
        font-size: 100px;
        color: #35495e;
        letter-spacing: 1px;
    }

    .subtitle {
        font-weight: 300;
        font-size: 42px;
        color: #526488;
        word-spacing: 5px;
        padding-bottom: 15px;
    }

    .links {
        padding-top: 15px;
    }
</style>
